[#746] establish default order for replicas listed by an iRODSDataObject#815
[#746] establish default order for replicas listed by an iRODSDataObject#815d-w-moore wants to merge 6 commits into
iRODSDataObject#815Conversation
Keep in mind that for a minor release, we cannot change the behavior of any public APIs. If the default sorter results in the output being different, then that's a no go. The default sorter must mirror the original behavior.
What are you referring to in regard to deprecation?
What does this mean? |
We'd discussed in the old issue/PR convo's whether we might not just deprecate the
Just that .replicas[0].FIELD is mirrored in .FIELD, but that is pretty natural. |
|
@korydraughn - I'm fine with changing the default order back to sorting on replica number for this minor release, even if it will allow attributes such as |
Oh right. That still sounds like an acceptable approach.
I'm not yet convinced that is the proper approach. Feels like it should be handled via support functions which simplify the find-replica step. Do instances of |
0cc7227 to
a9c4e99
Compare
|
Have I addressed this already, @korydraughn ?
If not, perhaps you could elaborate? So should we be changing the interface in regards to how replicas are actually found; or do we actually only want one replica represented by any iRODSDataObject instance? I could not tell which interpretation you meant. |
|
I don't know if you've addressed it.
I'm highlighting that providing the list of replicas is all that's needed. We do not need to mirror properties from replica N to the I didn't see a response to this question.
|
The replica list is always there, and - yes - initialized and sorted in the In this PR we at least allow the possibility of feeding in an alternative value for |
|
Makes sense to me. The leading underscore on the sort functions - consider making those public (i.e. remove leading underscore?). That will keep users from needing to implement their own version of them. |
sounds good. and, will wait for tests to pass before squashing. |
|
Please notify when ready for one last pass over. |
addressing the ruff gopher-holes first. Then will squash and notify. |
|
Ok ... the ruff drumbeat is now silent. Except for now there's a couple of codacy warnings, which I'm choosing not to heed right now as they are very minor. |
f7e6c10 to
07a9710
Compare
|
squashed |
korydraughn
left a comment
There was a problem hiding this comment.
Looks good. Just one question regarding a code comment.
|
Squash it. |
The iRODSDataObject has thus far sorted its replicas list by ascending replica order. replica_sort_function is a new keyword option recognized by both <session>.data_objects.get() and the iRODSDataObject constructor, and either can be given an alternate value (REPLICA_FITNESS_SORT_KEY_FN) or even a user-defined sort key if desired in order to alter replica order to a way that conforms more to user requirements.
|
request final review of doc string changes.... |
| control threads should be used. | ||
| updatables: a tuple or list in which each element is a tqdm-like progress bar object, or the equivalent: | ||
| an instance on which func.update(n) can be called with n being the number of bytes successfully | ||
| copied in the the data transfer increment just completed. If not a tuple or list, this argument |
There was a problem hiding this comment.
| copied in the the data transfer increment just completed. If not a tuple or list, this argument | |
| copied in the data transfer increment just completed. If not a tuple or list, this argument |
| local_path: a filename within the local filesystem, the target for download ("GET") of the data | ||
| object if one is requested. Directory components in the path must already exist. | ||
| num_threads: in the case of a parallel data transfer (for large files), specifies how many transfer | ||
| control threads should be used. | ||
| updatables: a tuple or list in which each element is a tqdm-like progress bar object, or the equivalent: | ||
| an instance on which func.update(n) can be called with n being the number of bytes successfully | ||
| copied in the the data transfer increment just completed. If not a tuple or list, this argument | ||
| is interpreted as a single updatable. | ||
| replica_sort_function: a sort key function dictating the order of replica query results in 'self.replicas' |
There was a problem hiding this comment.
These parameters have default arguments which are not explained or mentioned. Please document what the behavior is when the defaults are used.
Co-authored-by: Terrell Russell <terrellrussell@gmail.com>
The parent data object's
modify_timeandreplica_statusfields , as well as some others, actually pertain more to individual replicas.#747 was an old PR meant to address the issue and contains much discussion as well.
On consideration, I think a minor release is the proper place to address this, and I'm doing it by
data_objects.get( or anytime running theiRODSDataObjectconstructor) sorts replicas of the data object first by the replica-"goodness" and secondly by reverse chronology of the replicamodify_time(ie most recent first.) The replica at array position [0] will then determine the values of the fields discussed above.modify_timeandreplica_statusto be accessed from the "head" object.So, this PR replaces the old one, #747 , due to being new work and being based on top of source code conveniently ruff-formatted.